/* hp03.h

Copyright (C) Alex S. (mailto: md5sum@alexsp.ru)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details
http://www.gnu.org/licenses/gpl-2.0.html.

You should have received a copy of the GNU General Public License
along with this program in the file gpl-2.0.txt;
if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/


#ifndef HP03_H_
#define HP03_H_
#include "hardware.h"
#include "twi_hw.h"

#define HOP03_MCLK_PORT PORTD
#define HOP03_MCLK_MASK (1<<PD5)
#define HOP03_XCLR_PORT PORTD
#define HOP03_XCLR_MASK (1<<PD6)

#define HOP03_EEPROM_w 0xa0
#define HOP03_EEPROM_r 0xa1
#define HOP03_EEPROM_start 0x10
#define HOP03_ADC_addrW 0xee
#define HOP03_ADC_readcmd 0xfd
#define HOP03_ADC_startcmd 0xff
#define HOP03_ADC_addrR 0xef
#define HOP03_ADC_D1 0xf0
#define HOP03_ADC_D2 0xe8

typedef hw_ret_status hop03_ret_status;

//#define HOP03_swap(a,b) ((a>>8)&0x00ff)|((a<<8)&0xff00)
hop03_ret_status HOP03_init();
hop03_ret_status HOP03_get_value(double *press, double *temp);
#endif /* HP03_H_ */
